package top.cluski.feieprint.config;

import jakarta.annotation.Resource;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import top.cluski.feieprint.framework.TokenInterceptor;
import top.cluski.feieprint.framework.TraceInterceptor;

@Component
public class WebConfiguration implements WebMvcConfigurer {
    @Resource
    TokenInterceptor tokenInterceptor;
    @Resource
    TraceInterceptor traceInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(tokenInterceptor)
                .excludePathPatterns("/youzan/callback", "/maiyatian/callback", "/error");
        registry.addInterceptor(traceInterceptor);
        WebMvcConfigurer.super.addInterceptors(registry);
    }
}
